from langchain.prompts import PromptTemplate
from langchain_core.messages import HumanMessage, AIMessage
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder, FewShotPromptTemplate
from langchain_openai import ChatOpenAI

prompt_template = PromptTemplate.from_template("你是{name}")
result = prompt_template.format(name = '123')
print(result)

llm = ChatOpenAI(
    openai_api_base="https://api.siliconflow.cn/v1/",
    openai_api_key="sk-pdfifkpjdlxvyvgkerbluaotktpznsmpbcvskjauotenxgvz",  # app_key
    model_name="deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B",  # 模型名称
)

prompt = ChatPromptTemplate.from_messages([
    # SystemMessage(content="你是一名优秀的AI助手，名字叫小白"),
    ("system", "你是一名优秀的AI助手，名字叫小白"),
    # ("human","{input}"),
    MessagesPlaceholder("msgs")
])

prompt_final = prompt.invoke({"msgs":[HumanMessage('你好'),AIMessage('你好')]})
print(prompt_final)
# strOutputParser = StrOutputParser()
# chain = prompt | llm | strOutputParser
# result =  chain.invoke({"input":"你好，你是谁"})
# print(result)

FewShotPromptTemplate()

from langchain_core.prompts.prompt import PromptTemplate